package com.study.mike.spring.sample.aop;

import org.springframework.stereotype.Component;

@Component
public class TargetBean {

	public String exec(String task, int time) {
		System.err.println(String.format("TargetBean#exec(%s, %s)", task, time));
		if (time < 3) {throw new RuntimeException("辣鸡");}
		return "xxx";
	}

	public void do1(String task, int time) {
		System.out.println("------------- TargetBean#do1 " + task + ", time:" + time);
	}

	public String service1(String name) {
		System.out.println("------------- TargetBean#servce1 name=" + name);
		return name;
	}

	public String service2(String name) {
		System.out.println("------------- TargetBean#servce2 name=service2" + name);
		if (!"s1".equals(name)) {
			throw new IllegalArgumentException("参数 name ！= s1, name=" + name);
		}

		return name + " hello!";
	}
}
